package com.ssmdemo.pojo;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;

@TableName(value = "t_dept")
public class Dept {

    @TableId(type = IdType.AUTO)
    Integer id;
    @TableField(value = "dept_name")
    String deptName;
    @TableField(value = "dept_desc")
    String deptDesc;
    @TableField(exist = false)
    Dept parentDept;
    @TableField(value = "state")
    Integer state;
    @TableField(exist = false)
    Integer subId;
    @TableField(value = "parent_id")
    Integer parentId;

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getDeptDesc() {
        return deptDesc;
    }

    public void setDeptDesc(String deptDesc) {
        this.deptDesc = deptDesc;
    }

    public Dept getParentDept() {
        return parentDept;
    }

    public void setParentDept(Dept parentDept) {
        this.parentDept = parentDept;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
//        if (getParentDept().deptName==null){
//            this.state = 0;
//        }else {
//            this.state = state;
//        }
        this.state = state;
    }

    public Integer getSubId() {
        return subId;
    }

    public void setSubId(Integer subId) {
        this.subId = subId;
    }

    @Override
    public String toString() {
        return "Dept{" +
                "id=" + id +
                ", deptName='" + deptName + '\'' +
                ", deptDesc='" + deptDesc + '\'' +
                ", parentDept=" + parentDept +
                ", state=" + state +
                '}';
    }
}
